<?php
function create_user_sn($prefix = '', $length = 8)
{
    $rand_str = '';
    for ($i = 0; $i < $length; $i++) {
        $rand_str .= mt_rand(0, 9);
    }
    $sn = $prefix . $rand_str;
    $user = \App\Http\Logic\UserLogic::getUserInfo(['name' =>$sn]);
    if ($user) {
        return create_user_sn($prefix, $length);
    }
    return $sn;
}
